﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Panny.Data;
namespace Model
{
    public class CorpCommentData
    {
        #region Insert
        public int Insert(string username,string corpID,string content,string iface,string iservice,string iprice,string ipop)
        {
            StringBuilder sql = new StringBuilder();
            sql.Append( "insert into CorpComment(CorpID,UserName,Content,IFace,IService,IPrice,IPop)" );
            sql.AppendFormat(" values('{0}','{1}','{2}','{3}','{4}','{5}','{6}') ", corpID,username, content, iface, iservice, iprice, ipop);
            using (SqlText insertion = new SqlText(sql.ToString()))
            {
                return insertion.ExecuteNonQuery();
            }
        }
        #endregion

        #region select
        public DataSet SelectByCorpID(int corpID)
        {
            string sql = string.Format("select * from CorpComment where CorpID={0} order by createon desc", corpID);
            using (SqlText selection = new SqlText(sql))
            {
               return selection.GetDataset();
            }
        }
        #endregion 
    }
}
